﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace Vehicle.DAL
{
    /// <summary>
    /// Copyright (C) M-Tear团队
    /// 文 件 名：Pilot.cs
    /// 版    本：v1.00.0000
    /// 创建标识：2009-08-30    Created by 杨光远 V1.00.0000
    /// 功能说明：Pilot表数据层类（继承于数据层基类)
    /// 注意事项：无
    /// 
    /// 更新记录：
    /// 
    /// </summary>
    public class Pilot : DAL.Base_DAL, Vehicle.Interface.IPilot
    {
        /// <summary>
        /// 绑定页面DropDownList控件
        /// </summary>
        /// <param name="drop">下拉菜单控件</param>
        public void DropDownListBind(DropDownList drop, Model.ComponentsInfo m_ComponentsInfo)
        {
            drop.DataSource = GetModel(m_ComponentsInfo).DefaultView;
            drop.DataTextField = "P_Name";//显示的名称
            drop.DataValueField = "P_ID";//数据值
            drop.DataBind();
            drop.Items.Add(new ListItem("无", "0"));
            drop.SelectedValue = "0";  //默认选择全部
        }
        /// <summary>
        /// 添加驾驶员信息
        /// </summary>
        /// <param name="m_PilotInfo">驾驶员实体层</param>
        public void Add(Model.PilotInfo m_PilotInfo)
        {
            string SpName = "Pilot_ADD";
            object[] _object = new object[] { 0, m_PilotInfo.M_ID, m_PilotInfo.V_ID, m_PilotInfo.P_Num, m_PilotInfo.P_Age, m_PilotInfo.P_CarAge, m_PilotInfo.P_Sex, m_PilotInfo.P_License, m_PilotInfo.P_Name, m_PilotInfo.P_Tel, m_PilotInfo.P_Address, m_PilotInfo.P_CardID, m_PilotInfo.P_Transit, m_PilotInfo.P_Note, m_PilotInfo.P_LastTime, m_PilotInfo.P_IsDelete, m_PilotInfo.P_Time };
            SqlHelper.ExecuteNonQuery(SpName, _object);
        }
        /// <summary>
        /// 绑定页面Repeater控件
        /// </summary>
        /// <param name="Rept">Repeater控件</param>
        ///  <param name="m_ComponentsInfo">系统通用实体层</param>
        public void RepeaterBind(Repeater Rept, Model.ComponentsInfo m_ComponentsInfo)
        {
            Rept.DataSource = GetAllSearch(new Model.ComponentsInfo(m_ComponentsInfo.startIndex, m_ComponentsInfo.endIndex, "Pilot", m_ComponentsInfo.condition, m_ComponentsInfo.result, m_ComponentsInfo.Tcondition, m_ComponentsInfo.Tresult, m_ComponentsInfo.Scondition, m_ComponentsInfo.Sresult, "P_Time", m_ComponentsInfo.StartTime, m_ComponentsInfo.EndTime, "P_ID")).DefaultView;
            Rept.DataBind();
        }
        /// <summary>
        /// 修改驾驶员信息
        /// </summary>
        /// <param name="m_PilotInfo">驾驶员实体层</param>
        public void Update(Model.PilotInfo m_PilotInfo)
        {
            string SpName = "Pilot_Update";
            object[] _object = new object[] { 0, m_PilotInfo.P_ID, m_PilotInfo.M_ID, m_PilotInfo.V_ID, m_PilotInfo.P_Num, m_PilotInfo.P_Age, m_PilotInfo.P_CarAge, m_PilotInfo.P_Sex, m_PilotInfo.P_License, m_PilotInfo.P_Name, m_PilotInfo.P_Tel, m_PilotInfo.P_Address, m_PilotInfo.P_CardID, m_PilotInfo.P_Transit, m_PilotInfo.P_Note, m_PilotInfo.P_LastTime, m_PilotInfo.P_IsDelete, m_PilotInfo.P_Time };
            SqlHelper.ExecuteNonQuery(SpName, _object);
        }
    }
}
